import React from "react"
import ReactDOM from "react-dom"
import "./index.css"
import App from "./App"
// import reportWebVitals from "./reportWebVitals"
import "./i18n/configs"
import { Provider } from "react-redux"
// import store from "./redux/store"
import rootStore from "./redux/store"
import store from "./redux/store"
// import Mock from "mockjs"
import "./mock/index"
import { PersistGate } from "redux-persist/integration/react" //redux-persist针对react开发的provider
import axios from "axios"

// if (process.env.NODE_ENV === "development") {
//   // 启用Mock
//   Mock.setup({ timeout: "300-600" }) // 可选：设置响应延时

//   // 加载Mock规则文件
//   require("./mock/index") // 调用包含Mock规则的文件
// }
// 创建persistor
axios.defaults.headers["x-icode"] = "FB80558A73FA658E"
ReactDOM.render(
  <React.StrictMode>
    <Provider store={rootStore.store}>
      <PersistGate loading={null} persistor={rootStore.persistor}>
        {/* 会在app启动时读取localStorage数据，肯呢个会对I/O造成阻塞，引起界面停顿 */}
        <App />
      </PersistGate>
    </Provider>
  </React.StrictMode>,
  document.getElementById("root")
)
// const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement)
// root.render(
//   <React.StrictMode>
//     <App />
//   </React.StrictMode>
// )

// // If you want to start measuring performance in your app, pass a function
// // to log results (for example: reportWebVitals(console.log))
// // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
// reportWebVitals()
